<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="mall.demo.util.SessionKeyEnum" %>
<%@ page import="java.util.List" %>
<%@ page import="mall.demo.mybatis.pojo.Order" %>
<%@ page import="mall.demo.mybatis.service.OrderService" %>
<%
Object isAdminInObj = (Object)session.getAttribute(SessionKeyEnum.adminObj.name());
System.out.println("isAdminIn=" + isAdminInObj);
if(isAdminInObj == null) {
	//如果没有登录，跳转到登录页面
	response.sendRedirect(request.getContextPath() + "/admin/login.jsp");
	return;
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>后台-订单</title>
<link href="../css/bootstrap.css" rel="stylesheet">

<script src="../js/jquery.js?_=201703042022"></script>
<script src="../js/bootstrap.js"></script>

</head>
<%
List<Order> list = (new OrderService()).getAllOrders();
%>
<body>
<div class="container">
<jsp:include page="menu.jsp"></jsp:include>

<table>
<tr><th>Code</th><th>用户</th><th>总价</th><th>状态</th><th>最后更新时间</th><th></th></tr>
<% for (Order order : list) {%>
<tr><td><%= order.getCode() %></td>
	<td><%= order.getUser().getDisplayName() %></td>
	<td><%= order.getTotalPrice() %></td>
	<td><%= order.getStatus() %></td>
	<td><%= order.getLastTime() %></td>
	<td><a href="../servlet/updateOrderStatus.do?oid=<%=order.getOrderId()%>">下一个状态</a> </td>
	
</tr>
<% } %>
</table>
</div>
</body>
</html>